/**
 * @filename:${entityName}Controller ${createTime}
 * @project ${project}  ${version}
 * Copyright(c) 2021 ${author} Co. Ltd.
 * All right reserved. 
 */
package ${controllerUrl};

import ${abstractControllerUrl}.AbstractController;
import ${entityUrl}.${entityName};
import ${serviceUrl}.${entityName}Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
<#if isSwagger=="true" >
import io.swagger.annotations.Api;
</#if>

/**
 * ${entityComment}API接口层
 * @version: ${version}
 * @author: ${author}
 * @date    ${createTime}
 */
<#if isSwagger=="true" >
@Api(tags = "${entityComment}")
</#if>
@RestController
@RequestMapping("/${objectName}")
@AllArgsConstructor
public class ${entityName}Controller extends BaseController{
  private ${entityName}Manager ${objectName}Manager;

  @ApiOperationSupport(author = "${author}")
  @ApiOperation(value = "新增")
  @PostMapping
  public ResponseEntity create${entityName}() {
    ${objectName}Manager.create${entityName}();
    return ResponseEntity.status(HttpStatus.CREATED).build();
  }

  @ApiOperationSupport(author = "${author}")
  @ApiOperation(value = "更新")
  @PutMapping("/{id}")
  public ResponseEntity update${entityName}() {
    ${objectName}Manager.update${entityName}();
    return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
  }

  @ApiOperationSupport(author = "${author}")
  @ApiOperation(value = "删除")
  @DeleteMapping("/{id}")
  public ResponseEntity delete${entityName}(@PathVariable("id") Long id) {
    ${objectName}Manager.delete${entityName}(id);
    return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
  }

  @ApiOperationSupport(author = "${author}")
  @ApiOperation(value = "分页查询")
  @GetMapping
  public ResponseEntity<List<${entityName}Dto>> page(@Valid QueryPage queryPage){
    return ok(${objectName}Manager.queryPage${entityName}Dtos(queryPage));
  }
}